<div class="filter-bar">
	<form action="__CONTROLLER__/index" method="post" >
		<div class="view">
			<div class="row clearfix">
				<div class="col-md-4 column row ui-sortable">
				    <label class="col-sm-4 control-label" style="margin-top: 8px;">商品名称</label>
				    <div class="col-sm-8">
				   		<input type="text" name="name" class="form-control" value="{$params.name}"/>
				    </div>
				</div>	
				<div class="col-md-4 column row ui-sortable">
				    <div style="margin-right:120px">
			             <input type="submit"  class="btn btn-primary" value="搜索">
				    </div>
				</div>	
			</div>
		</div>
	</form>
</div>
<hr/>
<table class="table table-hover">
  <thead>
    <tr>
      <th>ID</th>
      <th>商品名称</th>
      <th>发布时间</th>
      <th>价格</th>
      <th>销量</th>
      <td>排序</td>
      <th>状态</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    <volist name="distributionShopGoodsLists" id="vo">
      <tr>
        <td>{$vo.id}</td>
        <td>{$vo.name}</td>
        <td>{$vo.create_time|date="Y-m-d H:m", ###}</td>
        <td>{$vo.price}{$vo["priceAttribute"]}</td>
        <td>{$vo.saled_count}</td>
        <td><input type="text" goods-id="{$vo.id}"  style="width:40px;text-align:center;" min="0" type="number" class="Num" value="{$vo.sort}"/></td>
        <td class="status">{$vo["status"]?"上架":"下架"}</td> 
        <td>
          <a class="btn btn-primary btn-xs" href="__CONTROLLER__/modify/id/{$vo.id}">修改</a>
          <a class="btn btn-primary btn-xs clip" href="javascript:void(0)" id="copyUrl_{$vo.id}" data-url="{$vo.goodsUrl}">复制活动地址</a>
          <a class="btn btn-primary btn-xs" href="__CONTROLLER__/setAttribute/id/{$vo.id}">设置属性</a>
          <a class="btn btn-primary btn-xs" href="{:U('DistributionShopGoodsMaterial/index', 'productId='.$vo['id'])}">素材管理</a>
          <a class="btn btn-info btn-xs action-status" data-action-id="{$vo.id}" data-action-txt="执行中……" data-action-status="{$vo.status}" data-action-status-txt="上架 下架" data-action-url="__CONTROLLER__/setStatus">{$vo["status"]?"下架":"上架"}</a>
          <a class="btn btn-danger btn-xs actionds" data-action-id="{$vo.id}" data-action-txt="移除中……" data-action-url="__CONTROLLER__/remove">移除</a>
        </td>
      </tr>
    </volist>
  </tbody>
</table>
<div class="pagination">{$pagination}</div>

<script>
$(function(){
	$(".Num").blur(function(){
		var oId = $(this).attr("goods-id");
		var onum = $(this).val();
		var ourl="{:U('DistributionShopGoods/setSort')}";
		  $.ajax({
	           type:'POST',
	           url:ourl,
	           data:{id:oId, sort:onum},  
	           success:function(data){}
		  })
	})
	
});
</script>

<script type="text/javascript" src="__PUBLIC__/Style/Common/js/ZeroClipboard.js"></script>
<script>
    $(function() {
        $('.clip').each(function(i, elem) {
            $().copyPaste({
                text: $(elem).attr('data-url'),
                id: $(elem).attr("id")
            });

        })
    });
</script>
    
